<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');
/**
 * CodeIgniter
 *
 * An open source application development framework for PHP 5.1.6 or newer
 *
 * @package		CodeIgniter
 * @author		ExpressionEngine Dev Team
 * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc.
 * @license		http://codeigniter.com/user_guide/license.html
 * @link		http://codeigniter.com
 * @since		Version 1.0
 * @filesource
 */
// ------------------------------------------------------------------------

/**
 * Active Record Class
 *
 * This is the platform-independent base Active Record implementation class.
 *
 * @package		CodeIgniter
 * @subpackage	Drivers
 * @category	Database
 * @author		ExpressionEngine Dev Team
 * @link		http://codeigniter.com/user_guide/database/
 */
class record extends CI_DB_active_record {

    public function __construct($params) {
        parent::__construct($params);
    }

    // --------------------------------------------------------------------

    /**
     * Where
     *
     * Generates the WHERE portion of the query. Separates
     * multiple calls with AND
     *
     * @param	mixed
     * @param	mixed
     * @return	object
     */
    public function is_null_where($key) {
        return $this->_where($key . ' is null', NULL, 'AND ', FALSE);
    }

    // --------------------------------------------------------------------

    /**
     * OR Where
     *
     * Generates the WHERE portion of the query. Separates
     * multiple calls with OR
     *
     * @param	mixed
     * @param	mixed
     * @return	object
     */
    public function is_null_or_where($key) {
        return $this->_where($key . ' is null', NULL, 'OR ', FALSE);
    }

    // --------------------------------------------------------------------

    /**
     * Where
     *
     * Generates the WHERE portion of the query. Separates
     * multiple calls with AND
     *
     * @param	mixed
     * @param	mixed
     * @return	object
     */
    public function is_not_null_where($key) {
        return $this->_where($key . ' is not null', NULL, 'AND ', FALSE);
    }

    // --------------------------------------------------------------------

    /**
     * OR Where
     *
     * Generates the WHERE portion of the query. Separates
     * multiple calls with OR
     *
     * @param	mixed
     * @param	mixed
     * @return	object
     */
    public function is_not_null_or_where($key) {
        return $this->_where($key . ' is not null', NULL, 'OR ', FALSE);
    }

    // --------------------------------------------------------------------

    /**
     * locate_table
     *
     * Generates the WHERE portion of the query. Separates
     * multiple calls with OR
     *
     * @param	mixed
     * @param	mixed
     * @return	boolean
     */
    public function locate_table($banco, $tabela) {
        $CI = &get_instance();
        $this->data_cache = array();
        $this->database = $banco;
        $this->db_select();
        $CI->load->dbutil();
        if ($CI->dbutil->database_exists($banco)) {
            if ($this->table_exists($tabela)) {
                return TRUE;
            } else {
                return FALSE;
            }
        } else {
            return FALSE;
        }
    }

}

/* End of file DB_active_rec.php */
/* Location: ./system/database/DB_active_rec.php */